/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.j;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.f.b;
import com.qihoo.gamecenter.sdk.common.h.d;
import com.qihoo.gamecenter.sdk.common.h.d.a;
import com.qihoo.gamecenter.sdk.common.i.f;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.pay.k.c;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.json.JSONObject;

public class n extends d {
    private Intent b;

    public n(Context paramContext, Intent paramIntent, d.a parama) {
        super(paramContext, parama, true);
        this.b = paramIntent;
    }

    protected String a(Context paramContext, String[] paramArrayOfString) {
        return null;
    }

    protected String a() {
        return "http://mgame.360.cn/bankpay/getverify.json";
    }

    protected Map b(Context paramContext, String[] paramArrayOfString) {
        String str1 = this.b.getStringExtra("qihoo_user_id");
        if (TextUtils.isEmpty(str1)) {
            c.b("OAGetVerifyCodeTask", new Object[] { "@GetBankTask: Qid is NULL!" });
            return null;
        }
        String str2 = this.b.getStringExtra("access_token");
        if (TextUtils.isEmpty(str2)) {
            c.b("OAGetVerifyCodeTask", new Object[] { "@GetBankTask: Access token is NULL!" });
            return null;
        }
        String str3 = a(0, paramArrayOfString);
        if (TextUtils.isEmpty(str3)) {
            c.b("OAGetVerifyCodeTask", new Object[] { "@GetBankTask: OrderId is NULL!" });
            return null;
        }
        String str4 = a(1, paramArrayOfString);
        if (TextUtils.isEmpty(str4)) {
            c.b("OAGetVerifyCodeTask", new Object[] { "@GetBankTask: Mobile number is NULL!" });
            return null;
        }
        TreeMap localTreeMap = new TreeMap();
        localTreeMap.put("app_key", s.r(paramContext));
        localTreeMap.put("user_id", str1);
        localTreeMap.put("order_id", str3);
        localTreeMap.put("access_token", str2);
        localTreeMap.put("card_phone", str4);
        localTreeMap.put("t", String.valueOf(System.currentTimeMillis()));
        String str5 = s.a(localTreeMap, s.s(paramContext));
        c.a("OAGetVerifyCodeTask", new Object[] { "http://mgame.360.cn/bankpay/getverify.json", "?", str5 });
        this.a = s.b();
        String str6 = f.c(str5, this.a);
        String str7 = b.a().a(this.a);
        localTreeMap = new TreeMap();
        localTreeMap.put("k", str7);
        localTreeMap.put("d", str6);
        c.a("OAGetVerifyCodeTask", new Object[] { a(), "?k=", str7, "&d=", str6 });
        return localTreeMap;
    }

    protected a b(JSONObject paramJSONObject) {
        if (paramJSONObject != null) {
            int i = paramJSONObject.optInt("error_code", -1);
            a locala = new a();
            a.a(locala, i);
            a.a(locala, paramJSONObject.optString("error", ""));
            a.b(locala, paramJSONObject.optString("order_id", ""));
            int j = paramJSONObject.optInt("interval", 0);
            if (i != -1)
                switch (i) {
                case 0:
                    a.a(a.a(locala), j, new String[] { a.b(locala) });
                }
            return locala;
        }
        return null;
    }

    private static class b {
        private long a;
        private long b;
        private String c;

        public long a() {
            return this.a;
        }

        public void a(long paramLong) {
            this.a = paramLong;
        }

        public long b() {
            return this.b;
        }

        public void b(long paramLong) {
            this.b = paramLong;
        }

        public String c() {
            return this.c;
        }

        public void a(String paramString) {
            this.c = paramString;
        }
    }

    public static class a {
        private int a;
        private String b;
        private String c;
        private static HashMap d = new HashMap();

        public int a() {
            return this.a;
        }

        public void a(int paramInt) {
            this.a = paramInt;
        }

        public String b() {
            return this.b;
        }

        public void a(String paramString) {
            this.b = paramString;
        }

        public static long b(String paramString) {
            long l1 = 0L;
            if (!(TextUtils.isEmpty(paramString))) {
                n.b localb = (n.b) d.get(paramString);
                if (localb != null) {
                    l1 = localb.a();
                    long l2 = localb.b();
                    if (l1 > 0L) {
                        long l3 = System.currentTimeMillis();
                        long l4 = (l3 - l2) / 1000L;
                        l1 = (l4 > l1) ? 0L : l1 - l4;
                    }
                }
            }
            c.a("OAGetVerifyCodeTask",
                    new Object[] { "GetInterval BindId: ", paramString, " | Interval: ", Long.valueOf(l1) });
            return l1;
        }

        public static String c(String paramString) {
            if (!(TextUtils.isEmpty(paramString))) {
                n.b localb = (n.b) d.get(paramString);
                if (localb != null)
                    return localb.c();
            }
            return "";
        }

        public static void a(String paramString1, String paramString2) {
            c.a("OAGetVerifyCodeTask",
                    new Object[] { "SetResponseMsg BindId: ", paramString1, " | Msg: ", paramString2 });
            if (TextUtils.isEmpty(paramString1))
                return;
            n.b localb = (n.b) d.get(paramString1);
            if (localb == null)
                return;
            localb.a(paramString2);
        }

        public static void a(String paramString, long paramLong, String[] paramArrayOfString) {
            c.a("OAGetVerifyCodeTask",
                    new Object[] { "SetNewInterval BindId: ", paramString, " | Interval: ", Long.valueOf(paramLong) });
            if (TextUtils.isEmpty(paramString))
                return;
            n.b localb = new n.b(null);
            localb.a(paramLong);
            localb.b(System.currentTimeMillis());
            localb.a(((paramArrayOfString != null) && (paramArrayOfString.length > 0)) ? paramArrayOfString[0] : "");
            d.put(paramString, localb);
        }
    }
}